find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core)
find_package(OpenGL REQUIRED)

file(GLOB includes ${CMAKE_SOURCE_DIR}/include/QLibSsh/*.h)
file (GLOB srcs ${CMAKE_SOURCE_DIR}/src/*.cpp)

add_library(QLibSsh SHARED
    ${includes}
    ${srcs}
)

target_include_directories(QLibSsh PRIVATE
    ${PROJECT_SOURCE_DIR}/lib/include
    ${CMAKE_SOURCE_DIR}/include
)

set(LIB_PATH ${PROJECT_SOURCE_DIR}/lib)
# 设置lib输出位置
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

target_link_libraries(QLibSsh PRIVATE
    Qt${QT_VERSION_MAJOR}::Core
    ${OPENGL_LIBRARIES}
    ${LIB_PATH}/libssh.dll
)

target_compile_definitions(QLibSsh PRIVATE QLIBSSH_LIBRARY)
